package Demo1;

public class Test01 {
    public static void main(String[] args){
        //饿汉式
        Singleton s1 = Singleton.getInstance();
        Singleton s2 = Singleton.getInstance();
        if (s1==s2){
            System.out.println("s1和s2一样");
        }else {
            System.out.println("s1和s2不一样");
        }
        //懒汉式
        Singleton2 s3=Singleton2.getInstance2();
        Singleton2 s4=Singleton2.getInstance2();
        if (s3==s4){
            System.out.println("s3和s4一样");
        }else {
            System.out.println("s3和s4不一样");
        }

    }
}
